<div class = "form-group <?php echo (isset($errors) && isset($errors[$name])) ? 'has-error' : ''; ?>">
    <label class = "control-label <?php echo isset($required) ? 'required' : ''; ?>" for="<?= $name ?>"><?= $label ?>:</label>
    <input class = "form-control" placeholder = "<?= isset($placeholder) ? $placeholder : ''; ?>" name="<?= $name ?>" id="<?= $name ?>" value = "<?= $value ?>" />
    <?php if (isset($errors) && isset($errors[$name])) {
        ?>
        <small class="help-block"><?= $errors[$name] ?></small>
    <?php } ?>
</div>